<template>
	<view class="outBox">
		<u-navbar leftText="待审核的弟弟" leftIconColor="#fff" :autoBack="true" bgColor="rgba(0, 0, 0, 0.6)">
			<view class="left-slot" slot="left">
				<u-icon name="arrow-left" color="#fff"></u-icon>
				<text>{{ '待审核的弟弟' }}</text>
			</view>
		</u-navbar>
		<view class="bg"></view>
		<video :src="videoUrl + '/mp4/1.mp4'" autoplay :controls="false" loop object-fit="cover"></video>
		<!-- <video :src="videoPath" autoplay :controls="false" loop object-fit="cover"></video> -->
		<view class="content" :style="{
				marginTop:menuHeight + 'px',
			}">
			<view class="bindList">
				<view class="title">
					<text>申请绑定我的弟弟</text>
				</view>

				<view class="items" v-for="item in dataList">
					<view class="item" :style="{
			      backgroundImage: `url(${itemBg})`,
			      backgroundSize: '100% 100%'
			    }">
						<image :src="item.avatar" mode="scaleToFill"></image>
						<text class="name">{{ item.name }}</text>
						<text class="phone">{{ item.mobile }}</text>
						<view class="btns">
							<view class="btn btn1" @click="handleEdit(item,2)">通过</view>
							<view class="btn btn2" @click="handleEdit(item,3)">驳回</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<u-modal :show="showDia" title="提示" @cancel="showDia = false" @confirm="comfirmFunc"
			:showCancelButton="true" :content='title'></u-modal>
	</view>

	</view>
</template>

<script>
	import {
		getWXStatusHeight
	} from '@/utils/index.js'

	import {
		relationExamineListApi,
		relationExamineEditApi
	} from "../../api/api"
	export default {
		data() {
			return {
				baseImgUrl2: this.$baseImgUrl2,
				baseImgUrl: this.$baseImgUrl,
				videoUrl: this.$videoUrl,
				dataList: [],
				menuHeight: 0,
				showDia:false,
				editData:{
					id:null,
					examineStatus:null,
				},
				title:'',
			}
		},
		onLoad() {
			let obj = getWXStatusHeight()
			this.barWidth = obj.barWidth + 3
			this.menuHeight = obj.menuHeight
			this.getDataList()
		},
		methods: {
			async getDataList() {
				const res = await relationExamineListApi()
				if (res.code === 200) {
					this.dataList = res.data
				}
			},
			handleEdit(item,type){
				this.editData.id = item.id
				this.editData.examineStatus = type
				if(type === 2){
					this.title = '确认同意，该弟弟的绑定？'
				}else{
					this.title = '确认驳回，该弟弟的绑定？'
				}
				this.showDia = true
			},
			async comfirmFunc(){
				const res = await relationExamineEditApi(this.editData)
				if(res.code === 200){
					uni.showToast({
						title:'操作成功'
					})
					this.getDataList()
				}
				this.showDia = false
			}
		}
	}
</script>

<style lang="scss" scoped>
	.bindList {
		background: rgba(0, 0, 0, 0.52);
		border-radius: 60rpx;
		border: 2rpx solid;
		padding: 48rpx;
		border: 2rpx solid #21253B;
		margin-top: 30rpx;
		min-height: 200rpx;
		width: 684rpx;

		.waitExamineBox {
			position: absolute;
			right: 0;
			width: 164rpx;
			height: 40rpx;
			background: linear-gradient(162deg, rgba(15, 198, 194, 0.44) 0%, rgba(133, 243, 241, 0.69) 100%);
			border-radius: 14rpx 14rpx 14rpx 14rpx;
			display: flex;
			justify-content: center;
			align-items: center;

			text {
				font-size: 20rpx;
				color: #FFFFFF;
				line-height: 24rpx;
			}

			.circle {
				position: absolute;
				right: -9rpx;
				top: -9rpx;
				background-color: #fff;
				border-radius: 50%;
				color: #86909C;
				width: 18rpx;
				height: 18rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 18rpx;
			}
		}

		.items {
			.item {
				margin-top: 30rpx;
				width: 588rpx;
				height: 140rpx;
				background-size: 100% 100%;
				display: flex;
				align-items: center;
				position: relative;

				.btns {
					position: absolute;
					right: 26rpx;
					top: 50%;
					transform: translateY(-50%);
					.btn {
						width: 100rpx;
						height: 40rpx;
						font-size: 24rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						border-radius: 14rpx 14rpx 14rpx 14rpx;
					}

					.btn1 {
						background: rgba(52, 145, 250, 0.16);
						border: 2rpx solid #3491FA;
						color: #3491FA;
						margin-bottom: 20rpx;
					}

					.btn2 {
						background: rgba(52, 145, 250, 0.16);
						border: 2rpx solid #38D2D2;
						color: #20C9CB;
					}
				}

				image {
					width: 84rpx;
					height: 84rpx;
					border-radius: 50%;
					margin-right: 20rpx;
					margin-left: 30rpx;
				}

				.name {
					font-weight: 500;
					font-size: 28rpx;
					color: #FFFFFF;
					line-height: 28rpx;
					text-align: left;
					font-style: normal;
				}

				.phone {
					font-weight: 500;
					font-size: 28rpx;
					color: #86909C;
					line-height: 28rpx;
					text-align: left;
					font-style: normal;
				}

				text {
					margin-left: 30rpx;
				}
			}
		}

		.title {
			position: relative;
			font-weight: 400;
			height: 60rpx;
			font-size: 28rpx;
			color: #86909C;
			line-height: 28rpx;
			text-align: left;
			font-style: normal;
			padding-bottom: 20rpx;
			display: flex;
			align-items: center;
			position: relative;

			image {
				width: 32rpx;
				margin-left: 16rpx;
			}
		}
	}

	.content {
		position: relative;
		padding: 20rpx 40rpx;
		box-sizing: border-box;
		position: relative;
		z-index: 9;
	}

	.left-slot {
		color: #fff;
		display: flex;
		align-items: center;

		text {
			margin-left: 16rpx;
		}

		image {
			width: 40rpx;
			margin-right: 30rpx;
		}
	}

	.outBox {}

	.bg {
		background: rgba(0, 0, 0, 0.6);
		position: fixed;
		height: 100vh;
		width: 100vw;
		z-index: 2;
	}

	video {
		width: 100%;
		height: 100%;
		object-fit: cover;
		/* 确保视频填充整个容器，可能会裁剪视频 */
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 0;
	}
</style>